using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Code_Generator
{
	public abstract class Builder
	{
		readonly Setup m_Setup;

		protected Builder()
		{
			m_Setup = new Setup();
		}

		protected Builder(Setup setup)
		{
			m_Setup = setup;
		}

		public Setup Setup
		{
			get { return m_Setup; }
		}

		internal MetaData MetaData
		{
			get { return m_Setup.MetaData; }
		}

		protected virtual StringBuilder LoadTemplate(string section, string file)
		{
			var templateFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
			var fullPath = Path.Combine(templateFolder, section, file + ".template");
			var template = new StringBuilder(File.ReadAllText(fullPath));
			return template;
		}
	}
}
